<template>
  <view
    class="content"
    :style="{
      // 'padding-top': height + 'px',
    }"
  >
    <view
      :style="{
        width: '100%',
        height: statusBarHeight + 'px',
        background: 'rgba(39, 39, 39, 0.5)',
        position: 'fixed',
        top: 0,
        zIndex: 100,
      }"
    >
    </view>
    <view
      class="head"
      :style="{
        top: statusBarHeight + 'px',
        background: 'rgba(39, 39, 39, 0.5)'
      }"
    >
      <view class="head_left">
        <u-icon
          name="arrow-left"
          color="#EEEEEE"
          size="24"
          :bold="true"
          @click="toBack"
        ></u-icon>
      </view>
      <view class="text"> 我的订单 </view>
    </view>
    <view class="top" :style="{ marginTop: statusBarHeight+height + 'px' }">
      <view class="top_title">{{ detail.pay_status }}</view>
      <view class="top_text">{{ detail.msg }}</view>
    </view>

    <view class="box" >
      <view class="box_top">
        <image
          class="box_top_img"
          :src="detail.file_url"
          mode=""
        ></image>
        <view class="box_top_right">
          <view class="box_top_right_title">{{ detail.buy_name }}</view>
          <view class="box_top_right_num">数量：{{ detail.buy_number }}</view>
          <view class="box_top_right_price">
            <view class="box_top_right_price_title">合计</view>
            <view class="box_top_right_price_num"
              >￥{{ detail.total_price }}</view
            >
          </view>
        </view>
      </view>

      <view class="box_con">
        <view class="box_con_item">
          <view class="box_con_item_left">商品小计</view>
          <view class="box_con_item_price">￥{{ detail.total_price }}</view>
        </view>
        <view class="box_con_item box_con_item1">
          <view class="box_con_item_left">应付金额合计</view>
          <view class="box_con_item_price1">￥{{ detail.pay_price }}</view>
        </view>
      </view>

      <view class="box_con">
        <view class="box_con_item">
          <view class="box_con_item_left">优惠券</view>
          <view class="box_con_item_price">-￥{{ detail.coupon_price }}</view>
        </view>
        <view class="box_con_item">
          <view class="box_con_item_left">应付金额合计</view>
          <view class="box_con_item_price">￥{{ detail.pay_price }}</view>
        </view>
        <view class="box_con_item">
          <view class="box_con_item_left">订单编号</view>
          <view class="box_con_item_price">
            <view>{{ detail.order_sn }}</view>
            <view class="copy_view" @click="copy(detail.order_sn)">复制</view>
          </view>
        </view>
        <view class="box_con_item">
          <view class="box_con_item_left">支付方式</view>
          <view class="box_con_item_price">{{ detail.pay_type }}</view>
        </view>
        <view class="box_con_item box_con_item2">
          <view class="box_con_item_left">下单时间</view>
          <view class="box_con_item_price">{{ detail.create_time }}</view>
        </view>
      </view>
    </view>

    <view class="bottom" v-show="false">
      <view class="btn" @click="payment(detail)">继续支付</view>
    </view>
    <floatingBall></floatingBall>
  </view>
</template>
    
    <script>
export default {
  data() {
    return {
      statusBarHeight: 0,
      height: 0,
      orderId: "",
      detail: {},
    };
  },
  onLoad(options) {
    this.orderId = options.orderId;
    this.getDetail();
  },
  created() {
    const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度
    const windowHeihgt = statusBarHeight.windowHeight;
    this.statusBarHeight = statusBarHeight.statusBarHeight;
    this.$nextTick(() => {
      uni
        .createSelectorQuery()
        .select(".head")
        .boundingClientRect((data) => {
          this.height = data.height;
        })
        .exec();
    });
    
  },
  methods: {
    toBack() {
      uni.navigateBack({
        delta: 1,
      });
    },
    getDetail() {
      this.$http
        .orderDetail({ orderId: this.orderId })
        .then((res) => {
          console.log(res.data.order, "我的订单详情");
          this.detail = res.data.order;
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    copy(value) {
      uni.setClipboardData({
        data: value,
        success: function () {
          // console.log('复制成功',value);
        },
      });
    },
    payment(detail){
      // console.log(detail,999999999999)
      uni.navigateTo({
        url: `/pages/integral/payment?price=${detail.pay_price}&from=myDingdan&id=${detail.order_id}&detail=${JSON.stringify(detail)}`,
      });
    }
  },
};
</script>
    
    <style scoped lang="scss">
.content {
  position: fixed;
  box-sizing: border-box;
  background: url("/static/images/index.png") no-repeat;
  background-size: 100% 100%;
  .slot-content {
    view {
      display: flex;
      justify-content: center;
    }
  }
}

.head {
  width: 100%;
  padding: 18rpx 30rpx 47rpx;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  z-index: 99;
  background: rgba(39, 39, 39, 0.5);

  .head_left {
    position: absolute;
    left: 30rpx;
  }

  .head_right {
    position: absolute;
    right: 30rpx;
    color: #55b877;
  }

  .text {
    font-size: 36rpx;
    font-family: PingFang SC-Bold, PingFang SC;
    font-weight: 400;
    color: #eeeeee;
  }
}
.top {
  background: rgba(39, 39, 39, 0.5);
  padding: 30rpx;
  .top_title {
    font-size: 40rpx;
    color: #ffffff;
  }
  .top_text {
    color: #ffffff;
    margin-top: 8rpx;
  }
}

.box {
  padding: 30rpx;
  box-sizing: border-box;
  .box_top {
    background: rgba(39, 39, 39, 0.5);
    border-radius: 24rpx;
    display: flex;
    align-items: center;
    padding: 32rpx;
    .box_top_img {
      width: 180rpx;
      height: 180rpx;
      border-radius: 24rpx;
    }
    .box_top_right {
      flex: 1;
      margin-left: 30rpx;
      .box_top_right_title {
        font-size: 30rpx;
        color: #ffffff;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .box_top_right_num {
        font-size: 28rpx;
        color: #adadad;
        margin-top: 16rpx;
      }
      .box_top_right_price {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        font-size: 28rpx;
        margin-top: 36rpx;
        .box_top_right_price_title {
          color: #ffffff;
        }
        .box_top_right_price_num {
          color: #ff8a4c;
          margin-left: 8rpx;
        }
      }
    }
  }
  .box_con {
    background: rgba(39, 39, 39, 0.5);
    border-radius: 24rpx;
    padding: 32rpx;
    margin-top: 32rpx;
    .box_con_item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16rpx;
      .box_con_item_left {
        font-size: 28rpx;
        color: #adadad;
      }
      .box_con_item_price {
        font-size: 28rpx;
        color: #ffffff;
        display: flex;
        align-items: center;
        .copy_view {
          color: #55b877;
          margin-left: 16rpx;
        }
      }
      .box_con_item_price1 {
        font-size: 28rpx;
        color: #ff8a4c;
      }
    }
    .box_con_item1 {
      margin-top: 63rpx;
      margin-bottom: 0;
    }
    .box_con_item2 {
      margin-bottom: 0;
    }
  }
}

.bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 110rpx;
  background: #272727;
  padding: 16rpx 30rpx;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  .btn {
    width: 232rpx;
    height: 78rpx;
    background: #55b877;
    border-radius: 39rpx;
    text-align: center;
    line-height: 78rpx;
    font-size: 32rpx;
    color: #ffffff;
  }
}
</style>